﻿using ChurchWebsite.Controllers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ChurchDiary.TableEntity;
using ChurchDiary.BLL;
using ChurchDiary.Common;

namespace ChurchWebsite.Areas.Website.Controllers
{
    public class NewsletterController : BaseController
    {
        //
        // GET: /Website/Newsletter/

        public ActionResult Index()
        {
            ViewBag.IsSuperAdmin = Current.IsSuperAdmin;
            return View();
        }

        public JsonResult AddNewsletter(EntityNewsletter Newsletter)
        {
            return Json(new BLL_Website().InsertNewsletter(Newsletter), JsonRequestBehavior.AllowGet);
        }
        public JsonResult UpdateNewsletter(EntityNewsletter Newsletter)
        {
            return Json(new BLL_Website().UpdateNewsletter(Newsletter), JsonRequestBehavior.AllowGet);
        }
        public JsonResult DeleteNewsletter(Guid dataId)
        {
            return Json(new BLL_Website().DeleteNewsletter(dataId), JsonRequestBehavior.AllowGet);
        }
        public JsonResult GetNewsletters()
        {
            return Json(new BLL_Website().GetNewsletters(), JsonRequestBehavior.AllowGet);
        }
        public JsonResult GetNewsletter(Guid dataId)
        {
            return Json(new BLL_Website().GetNewsletter(dataId), JsonRequestBehavior.AllowGet);
        }
        public JsonResult ApproveRejectNewsletter(Guid NewsletterId, int Status)
        {
            return Json(new BLL_Website().ApproveRejectNewsletter(NewsletterId, Status), JsonRequestBehavior.AllowGet);
        }
        public JsonResult SendNewsletter(Guid NewsletterId)
        {
            return Json(new BLL_Website().SendNewsletter(NewsletterId), JsonRequestBehavior.AllowGet);
        }
        
    }
}
